<template>
	<view class="setup_index">
		<u-navbar :is-back="false" title="">
			<view class="slot_content">
				<view class="nav_img" @click="backTo">
					<image src="@/static/17.svg"></image>
				</view>
				<view class="nav_title">设置</view>
			</view>
		</u-navbar>
		<view class="item" @click="router('/pages/setup/realName')">
			<text>实名认证</text>
			<view class="right_view" v-if="$store.state.info.is_realname">
				<view class="already">
					<image src="@/static/21.svg"></image>
					<text>已认证</text>
				</view>
				<image src="@/static/20.svg"></image>
			</view>
			<image src="@/static/20.svg" v-else></image>
		</view>
		<view class="item" @click="routerToRanking">
			<text>排行榜</text>
			<image src="@/static/20.svg"></image>
		</view>
		<view class="item" @click="router('/pages/setup/security')">
			<text>安全中心</text>
			<image src="@/static/20.svg"></image>
		</view>
		<view class="item" @click="router('/pages/setup/help')">
			<text>帮助中心</text>
			<image src="@/static/20.svg"></image>
		</view>
		<view class="item login_out" @click="signout">退出登录</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		methods: {
			async signout() {
				this.$u.toast("已退出登录");

				this.$store.commit('outLogin');

				setTimeout(() => {
					uni.redirectTo({
						url: '/pages/login/login'
					})
				}, 1000);
			},
			routerToRanking() {
				let phb_open = this.$store.state.phb_open;
				if (phb_open == 2) {
					this.$u.toast("暂未开放");
					return false;
				};
				uni.navigateTo({
					url: '/pages/setup/rankingList'
				})
			},
			backTo() {
				uni.navigateBack()
			},
			router(url) {
				uni.navigateTo({
					url
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	.setup_index {
		padding: 0 30rpx;
		box-sizing: border-box;

		.item {
			height: 160rpx;
			border-bottom: 1px solid #F0F0F0;
			display: flex;
			justify-content: space-between;
			align-items: center;

			&.login_out {
				justify-content: center;
				color: #ED905B;
				font-size: 28rpx;
				border-bottom: none;
			}

			text {
				color: #2A2A2A;
				font-size: 28rpx;
			}

			image {
				width: 48rpx;
				height: 48rpx;
			}

			.right_view {
				display: flex;

				.already {
					display: flex;
					align-items: center;

					image {
						width: 24rpx;
						height: 24rpx;
					}

					text {
						color: #6BD288;
						font-size: 24rpx;
						font-weight: 400;
						margin: 0 16rpx;
					}
				}
			}
		}
	}
</style>
